<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/lib/bootstrap.min.css"/>
		<script src="js/lib/jquery-1.11.0.js"></script>
		<script src="js/lib/bootstrap.min.js"></script>
		<script src="js/base.js" type="text/javascript" charset="utf-8"></script>
	</head>
	 <style>
	 	body{
			font-size:12px;
		}
	 	table,
		th,
		td {
			border: 1px solid grey;
			border-collapse: collapse;
			padding: 5px;
			vertical-align: middle !important;
		}
		
		table td:nth-child(odd) {
			background-color: #f1f1f1;/*#e2e9ea*/
			
		}
		table td:nth-child(even) {
			
		}
		table tr:nth-child(even) {
			background-color:#ffffff;
		}
		input{
			width:280px;
		}
		span{
			width:20px;color:red;display:inline-block;text-align:center;
		}
		#sho{
			width:300px;
			height:50px;
			background:#d9534f;
			opacity:0.8;
			border-radius:8px;
			color:#fff;
			text-align: center;
			font-size:30px;
			position: absolute;
			top:0px;
			left:550px;
			display:none;
		}
	 </style>
	<body>
		<div class="">
			<div id="sho"></div>
		<!--添加一个品牌-->	
		<div style="padding:15px 5px 0px 5px;border:3px solid #ccc;margin-bottom:15px">
			<table class="table table-hover">
				
				<tbody>
					<tr>
						<th colspan="8">添加一个品牌：</th>
					</tr>
					<tr>
						<td>品牌名称:</td>
						<td colspan="3">
							<input class="form-control" style="width:280px;" id="p1" type="text" />
						
						</td>
						<td>安卓下载:</td>
						<td colspan="3">
							<input class="form-control" style="width:280px;"  id="p2" type="text"/>

						</td>						
					</tr>
					<tr>
						<td>ios下载:</td>
						<td colspan="3">
							<input class="form-control" style="width:280px;"  id="p3" type="text" />
							
						</td>
						<td>管理员手机:</td>
						<td colspan="3">
							<input class="form-control" style="width:280px;"  id="p4" type="text"/>
						</td>			
					</tr>					
					<tr>						
						<td colspan="8">
								<button id="btn" class="btn btn-danger" style="margin:0 auto;display:block;">点击添加</button>  								
						</td>										
					</tr>
				</tbody>
			</table>		
		</div>
		<!--按照品牌名查询品牌信息-->
			<div style="padding:15px 5px 0px 5px;border:3px solid #ccc;margin-bottom:15px">
			<table class="table table-hover">
				
				<tbody>
					<tr>
						<th colspan="8">按照品牌名查询品牌信息：</th>
					</tr>
					<tr>
						<td>品牌名称:</td>
						<td colspan="3">
							<input  class="form-control" style="width:280px;"  id="p5" type="text" />
						</td>
											
					</tr>				
					<tr>						
						<td colspan="8">
								<button id="btn1" class="btn btn-danger" style="margin:0 auto;display:block;">点击查询</button>  								
						</td>										
					</tr>
					<tr>
						<td class="text-center">品牌名称</td>
						<td class="text-center">品牌编号</td>
						<td class="text-center">管理编号</td>
						<td class="text-center">分享标题</td>
						<td class="text-center">分享内容</td>
						<td class="text-center">分享地址</td>
						<td class="text-center">结束时间</td>
					</tr>
					<tr id="show" style="display:none">
						<td class="text-center" id="show1"></td>
						<td class="text-center" id="show2"></td>
						<td class="text-center" id="show3"></td>
						<td class="text-center" id="show4"></td>
						<td class="text-center" id="show5"></td>
						<td class="text-center" id="show6"></td>
						<td class="text-center" id="show7"></td>
					</tr>
					<tr>
						<td colspan="8" id="show01" class="text-center" style="display:none;">
							
						</td>
					</tr>
				</tbody>
			</table>		
		</div>
		</div>
	</body>
	<script>
		$(function(){
			/*点击添加一个品牌*/
			$('#btn').click(function(){
				var a = $('#p1').val();
				var b = $('#p2').val();
				var c = $('#p3').val();
				var d = $('#p4').val();
				$.ajax({
					url:window.baseUrl+"user/brand/add",
					type:"POST",
					dataType:"json",
					data:{
						name:a,
						download_android:b,
						download_ios:c,
						manager_phone:d
					},
					success:function(data){
					    console.log(data)
						console.log("接口调用成功！")
						
					},
					error:function(data){
						console.log("接口调用失败！")
					}
				})
			})
			/*按照品牌名查询品牌信息*/
			$('#btn1').click(function(){
				var p5 = $('#p5').val();
				$.ajax({
					url:window.baseUrl+"user/brand/query/id",
					type:"GET",
					dataType:"json",
					data:{
						/*manager_id:433837908*/
						brand_id:p5
					},
					success:function(data){
						console.log("接口调用成功！")
						console.log(data.result)
						
						var msg = data.result[0]
						if(data.result.length == 0){
							$('#show').hide()
							$("#show01").show().html("暂无数据。。")	
						}else{
							$('#show01').hide()
							$('#show').show()
							/*$('#show1').html(msg.name)
							$('#show2').html(msg.number)
							$('#show3').html(msg.manageid)
							$('#show4').html(msg.shareTitle)
							$('#show5').html(msg.shareContent)
							$('#show6').html(msg.shareMainAddress)
							$('#show7').html(msg.createTime)*/
						}			
					},
					error:function(data){
						console.log("接口调用失败！")
					}
				})
			})
		})
	</script>
</html>
